/// @tags: WythoffGame
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>

namespace BlueQuantum {

double const PHI = (sqrt(5.0) + 1.0) / 2.0;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

int n, m;

inline int main() {
  read(n), read(m);
  if (n < m) std::swap(n, m);
  if (m == static_cast<int>(PHI * (n - m))) puts("0");
  else
    puts("1");
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("WythoffGame.in", "r", stdin);
  freopen("WythoffGame.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}